<include file="Public:header" />
	<div class="container">
		<div class="page-header">
			<h4>{:L('EDIT_THE_CONTACT')}</h4>
		</div>
		<div class="row">
			<div class="span12">
				<include file="Public:alert" />
				<form action="{:U('contacts/edit')}" method="post" onsubmit="return editConfirm()">
			<!-- 		<input type="hidden" name="redirect" value="{$redirect}"/>
					<input type="hidden" name="redirect_id" value="{$redirect_id}"/>
					<input type="hidden" name="contacts_id" value="{$contacts.contacts_id}"/>  -->
					<input type="hidden" name="contacts_id" id="contacts_id" value="{$contacts.contacts_id}"/>
					<table class="table table-hover" width="95%" border="0" cellspacing="1" cellpadding="0">
						<thead>
							<td>&nbsp;</td>
							<td <if condition="C('ismobile') neq 1">colspan="3"</if>><input name="submit" class="btn btn-primary" type="submit" value="{:L('SAVE')}"/> &nbsp; <input class="btn" type="button" onclick="javascript:history.go(-1)"  value="{:L('RETURN')}"/></td>
						</thead>
						<tfoot>
							<td>&nbsp;</td>
							<td <if condition="C('ismobile') neq 1">colspan="3"</if>><input name="submit" class="btn btn-primary" type="submit" value="{:L('SAVE')}"/> &nbsp; <input class="btn" type="button" onclick="javascript:history.go(-1)"  value="{:L('RETURN')}"/></td>
						</tfoot>
						<tbody>
							<tr><th <if condition="C('ismobile') eq 1">colspan="2"<else />colspan="4"</if>{:L('BASIC_INFO')}</th></tr>
							<tr>
								<td class="tdleft" width="15%" >{:L('NAME')}</td>
								<td width="35%"><input class="text-input large-input" type="text" name="name" id="name" value="{$contacts.name}"/></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" width="15%" >{:L('RESPECTFULLY')}</td>
								<td width="35%"><input class="text-input large-input" type="text" name="saltname" id="saltname" value="{$contacts.saltname}"/></td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('BELONGS_TO_THE_CUSTOMER_CLICK_TO_SELECT')}</td>
								<td><input name="customer_name" id="customer_name" type="text" value="{$contacts.customer_name}"/><input id="customer_id" name="customer_id" type="hidden" value="{$contacts.customer_id}"/></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('POSITION')}</td>
								<td>
									<input class="text-input large-input"  type="text" name="post" value="{$contacts.post}"/>
								</td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('PHONE')}</td>
								<td><input class="text-input large-input" name="telephone" type="text" value="{$contacts.telephone}"/></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('EMAIL')}</td>
								<td><input class="text-input large-input" name="email" type="text" value="{$contacts.email}"/></td>
							</tr>
							<tr>
								<td class="tdleft" >QQ</td>
								<td><input class="text-input large-input" name="qq" type="text" value="{$contacts.qq}"/></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('POSTCODE')}</td>
								<td><input class="text-input large-input" name="zip_code" type="text" value="{$contacts.zip_code}"/></td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('CONTACT_ADDRESS')}</td>
								<td><input class="text-input large-input" name="address" type="text" value="{$contacts.address}"/></td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('REMARK')}</td>
								<td <if condition="C('ismobile') neq 1">colspan="3"</if>><textarea rows="6" class="span8" name="description" >{$contacts.description}</textarea></td>
							</tr>
						</tbody>
					</table>
				</form>
			</div>
		</div> <!-- End #tab1 -->
	</div> <!-- End .content-box-content -->			
</div> <!-- End .content-box -->			

<div id="dialog-message2" title="{:L('SELECT_THE_CONTACT_BELONGS_TO_THE_CUSTOMER')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>
$("#dialog-message2").dialog({
	autoOpen: false,
	modal: true,
	width: width,
	maxHeight: 400,
	buttons: {
		"{:L('AFFIRM')}": function () {
			var item = $('input:radio[name="customer"]:checked').val();
			var name = $('input:radio[name="customer"]:checked').parent().next().html();
			if(item){
				$('#customer_name').val(name);
				$('#customer_id').val(item);
			}
			$(this).dialog("close");
		},
		"{:L('CANCEL')}": function () {
			$(this).dialog("close");
		}
	},
	position: ["center", 100]
});
<if condition="$contacts.saltname">$("#saltname option[value='{$leads.saltname}']").prop("selected", true);</if>
$(function(){
	$("#customer_name").click(
		function(){
			$('#dialog-message2').dialog('open');
			$('#dialog-message2').load('{:U("customer/listDialog")}');
		}
	);
});
</script>
<include file="Public:footer" />	